package com.xmd.red.utils;

import java.util.Calendar;
import java.util.Date;

/**
 * Created by superbone on 2016/12/18.
 */
public class RedTimeUtil {

    /**
     *
     * 2017-01-03修改
     * 日期修改为2017-01-04到2017-01-10
     *
     * 当前时间在2016-12-19到2016-12-21
     * 07:30 到 17:30之间可以领取红包
     * @return
     */
    public static boolean isRightTime(){

        Calendar calendar = Calendar.getInstance();
        int year = calendar.get(Calendar.YEAR);
        int month = calendar.get(Calendar.MONTH);
        int day = calendar.get(Calendar.DAY_OF_MONTH);
        int hour = calendar.get(Calendar.HOUR_OF_DAY);
        int minute = calendar.get(Calendar.MINUTE);

        if(year!=2017){
            return false;
        }
        if(month!=0){
            return false;
        }
        if(day<4||day>10){
            return false;
        }
        //开始时间
        int start = 7*60+30;
        //结束时间
        int end = 17*60+30;

        //当前时间
        int now = hour*60+minute;
        if(now<start || now > end){
            return false;
        }
        return true;
    }

    public static boolean isClose(){

        return true;
    }
}
